"""
__getattr__、__getattribute__魔法函数

__getattr__就是在查找不到属性的使用调用
"""

from datetime import date


class User:
    def __init__(self, name, birthday):
        self.name = name
        self.birthday = birthday

    def __getattr__(self, item):
        return "__getattr__ not find attr"

    # def __getattribute__(self, item):
    #     return "__getattribute__ not find attr"


def use_attr():
    user = User("Kevin", date(year=2008, month=1, day=1))
    print(user.name)
    print(user.age)
    # 输出结果：
    """
    Kevin
    __getattr__ not find attr
    """


if __name__ == '__main__':
    use_attr()
